package com.byzx.wine.util;

import java.io.Serializable;
import java.util.List;
import java.util.Map;



public class Page<T> implements Serializable{
	private static final long  serialVersionUID=-3198048449643774660L;
	
	private int pageNow=1;// 当前页数  
	private int pageSize;// 每页显示记录的条数
	private int totalCount;//总的记录条数
	private int totalPageCount;//总的页数

	
	private List<T> list;
	
	private Map<String,Object> param;
	

	/**
	 * 通过构造函数传入总记录数和当前页
	 */

	
	public Page(int pageNow,int pageSize,Map<String,Object> param1){
		this.param=param1;
		this.pageNow=pageNow;
		this.pageSize=pageSize;
		
		
	}
	
	
	
	public Page(int totalCount) {
		// TODO Auto-generated constructor stub
		this.totalCount=totalCount;
		this.totalPageCount=totalCount%pageSize==0?totalCount/pageSize:(totalCount/pageSize)+1;
	}
	public Page(int totalCount2, String pageName2, String departName2) {
		// TODO Auto-generated constructor stub
		this.totalCount=totalCount2;
		this.totalPageCount=totalCount%pageSize==0?totalCount/pageSize:(totalCount/pageSize)+1;
				
	}
	public Page(String pageName2, String departName2) {
		// TODO Auto-generated constructor stub
	}
	public Page(int totalCount1, Integer pageNow2, String pageName2,
			String departName2) {
		// TODO Auto-generated constructor stub
		this.totalCount=totalCount1;
		this.pageNow=pageNow2;
		this.totalPageCount=totalCount%pageSize==0?totalCount/pageSize:(totalCount/pageSize)+1;
	}
	public int getPageNow() {
		return pageNow;
	}
	public void setPageNow(int pageNow) {
		this.pageNow = pageNow;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int totalCount1) {
		this.totalPageCount=totalCount1%pageSize==0?totalCount1/pageSize:(totalCount1/pageSize)+1;
		this.totalCount = totalCount1;
	}
	
	/**
	 * 取得总页数，总页数=总记录数/页数 
	 */
	public int getTotalPageCount() {
		return totalPageCount;
		
	}
	public void setTotalPageCount(int totalPageCount) {
		this.totalPageCount = totalPageCount;
	}
	
	/**
	 * 是否是第一页
	 * @return
	 */
	public boolean isHasFirst() {
		return (pageNow==1)?false:true;
	}
	
	
	public List<T> getList() {
		return list;
	}
	public void setList(List<T> list) {
		this.list = list;
	}
	public Map<String, Object> getParam() {
		return param;
	}
	
	public void setParam(Map<String, Object> param) {
		this.param = param;
	}
	
	
}